<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>网页计算器</title>
</head>
<body>
    <p>
       整数1：
       <input type="text" id="one">
   </p>
   <p>
       整数2：
       <input type="text" id="tow">
   </p>
   <p>
       <button onclick="line('+')">加</button>
       <button onclick="line('-')">减</button>
       <button onclick="line('*')">乘</button>
       <button onclick="line('/')">除</button>
   </p>
   <p>
       和：
       <input type="text" id="sum">
   </p>
   
   <script>
       
       function line(e){
            var n1 = document.querySelector("#one").value;
            n1 = Number(n1);
            var n3 = document.querySelector("#tow").value;
            
            n3 = Number(n3);
           
           
            var ras = 0;
            switch(e){
                case '+':
                    ras = n1 + n3;
                    break;
                case '-':
                    ras = n1 - n3;
                    break;
                case '*':
                    ras = n1 * n3;
                    break;
                case '/':
                    ras = n1 / n3;
                    break;  
            }
            
        
           document.querySelector("#sum").value = ras;
       }
        
       
        
       
       
        
        
        
        
       
       
    
    </script>
</body>
</html>